#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n65_sb_test)
    .set noreorder
    addiu s0, s0, 1
    li  s2, 0x0
###test inst
    TEST_SB(0xb4f00930, 0x7955c40a, 0x800d16ec, 0x000061ec, 0x000061ec, 0xb4f0090a)
    TEST_SB(0x194331ca, 0x47657e06, 0x800d5068, 0x00006868, 0x00006868, 0x19433106)
    TEST_SB(0x9efafca8, 0x25474bf0, 0x800d9f20, 0x00003662, 0x00003660, 0x9ef0fca8)
    TEST_SB(0x9648ec44, 0x25165c46, 0x800d94a4, 0x000001fc, 0x000001fc, 0x9648ec46)
    TEST_SB(0xc93c8d07, 0x607047b4, 0x800df8f0, 0x000000fb, 0x000000f8, 0xb43c8d07)
    TEST_SB(0x2a18bf86, 0x33e94a7c, 0x800d54b4, 0x00005210, 0x00005210, 0x2a18bf7c)
    TEST_SB(0x4283bdfc, 0x48524d98, 0x800d4c20, 0x00005c56, 0x00005c54, 0x4298bdfc)
    TEST_SB(0xf950be60, 0x132a9383, 0x800d5b10, 0x00002ca8, 0x00002ca8, 0xf950be83)
    TEST_SB(0x712368e3, 0xa6a88b20, 0x800d9db0, 0x00003970, 0x00003970, 0x71236820)
    TEST_SB(0xd1b0ab60, 0x3384462f, 0x800da420, 0x00001560, 0x00001560, 0xd1b0ab2f)
    TEST_SB(0x06d2b531, 0x093c2180, 0x800d6f20, 0x000067de, 0x000067dc, 0x0680b531)
    TEST_SB(0xbc5e8270, 0xc97f4716, 0x800d1c3c, 0x000052e6, 0x000052e4, 0xbc168270)
    TEST_SB(0x67544f88, 0x4de16970, 0x800d0770, 0x00004571, 0x00004570, 0x67547088)
    TEST_SB(0x9a9163f0, 0x12043778, 0x800d9718, 0x00000121, 0x00000120, 0x9a9178f0)
    TEST_SB(0xe9a736d0, 0x02640360, 0x800d1e24, 0x00000f28, 0x00000f28, 0xe9a73660)
    TEST_SB(0xebf1c120, 0x23cfed10, 0x800dd340, 0x00001de4, 0x00001de4, 0xebf1c110)
    TEST_SB(0x58549334, 0x1b557440, 0x800d56f0, 0x0000430a, 0x00004308, 0x58409334)
    TEST_SB(0x0a1f3a0d, 0x9705c818, 0x800d869c, 0x0000197e, 0x0000197c, 0x0a183a0d)
    TEST_SB(0xc545eb10, 0xe26fd0dc, 0x800dd4a0, 0x000001f4, 0x000001f4, 0xc545ebdc)
    TEST_SB(0x2495a82c, 0x2b6d9dcc, 0x800d5654, 0x000046af, 0x000046ac, 0xcc95a82c)
    TEST_SB(0xd15526cc, 0x728525c0, 0x800d2538, 0x00000d04, 0x00000d04, 0xd15526c0)
    TEST_SB(0x4995521e, 0x09c0dd47, 0x800d2400, 0x0000bd3d, 0x0000bd3c, 0x4995471e)
    TEST_SB(0xe68fa3cb, 0xb7dcb7de, 0x800d5324, 0x000015a8, 0x000015a8, 0xe68fa3de)
    TEST_SB(0xa1d508e8, 0xfd2882a4, 0x800dbb68, 0x00003d18, 0x00003d18, 0xa1d508a4)
    TEST_SB(0x19515bd9, 0xd5fc8620, 0x800d2b20, 0x0000b797, 0x0000b794, 0x20515bd9)
    TEST_SB(0x431f36bc, 0x8de3033d, 0x800d83d4, 0x00004d0c, 0x00004d0c, 0x431f363d)
    TEST_SB(0x32329da6, 0x3eb8314c, 0x800de3a8, 0x00000ae5, 0x00000ae4, 0x32324ca6)
    TEST_SB(0xc12cc3cc, 0xcb6ea900, 0x800d4550, 0x000066a6, 0x000066a4, 0xc100c3cc)
    TEST_SB(0x4c48ff70, 0xe9ffefab, 0x800d82b4, 0x000041f4, 0x000041f4, 0x4c48ffab)
    TEST_SB(0x91006168, 0x0bcb7118, 0x800d4fdc, 0x00002f0c, 0x00002f0c, 0x91006118)
    TEST_SB(0x8fe739a2, 0x7d4a6bb6, 0x800d635c, 0x00001b7e, 0x00001b7c, 0x8fb639a2)
    TEST_SB(0x4be15cd4, 0xff481820, 0x800dd9e8, 0x000006e8, 0x000006e8, 0x4be15c20)
    TEST_SB(0xab84ef36, 0x229fa36c, 0x800d0f70, 0x00004c50, 0x00004c50, 0xab84ef6c)
    TEST_SB(0x0ab430f0, 0x9c605140, 0x800d1bb4, 0x0000bc54, 0x0000bc54, 0x0ab43040)
    TEST_SB(0xc9df3d10, 0x294337c4, 0x800d3a28, 0x0000a532, 0x0000a530, 0xc9c43d10)
    TEST_SB(0x8e71b1bc, 0x5471d562, 0x800d383c, 0x00002272, 0x00002270, 0x8e62b1bc)
    TEST_SB(0x03aae560, 0x19ea6d90, 0x800d0000, 0x0000f7ab, 0x0000f7a8, 0x90aae560)
    TEST_SB(0x49837840, 0x2a0a711c, 0x800d0000, 0x00003a40, 0x00003a40, 0x4983781c)
    TEST_SB(0x850813af, 0x6e98ee40, 0x800d0000, 0x0000296a, 0x00002968, 0x854013af)
    TEST_SB(0x8b01f0c8, 0x490a0f90, 0x800d0000, 0x000015a7, 0x000015a4, 0x9001f0c8)
    TEST_SB(0x553f5c64, 0x20129920, 0x800d0000, 0x0000730c, 0x0000730c, 0x553f5c20)
    TEST_SB(0xcf71b130, 0x9b0a4e5c, 0x800d0000, 0x00001b02, 0x00001b00, 0xcf5cb130)
    TEST_SB(0xdfc98d18, 0xf64deefc, 0x800d0000, 0x00009150, 0x00009150, 0xdfc98dfc)
    TEST_SB(0x5f92a4bd, 0x53ab798c, 0x800d0000, 0x0000be7a, 0x0000be78, 0x5f8ca4bd)
    TEST_SB(0x8bb6a77b, 0xf7b86140, 0x800d0000, 0x00001376, 0x00001374, 0x8b40a77b)
    TEST_SB(0xb10c9e34, 0xb3ce6a64, 0x800d0000, 0x00009b60, 0x00009b60, 0xb10c9e64)
    TEST_SB(0x6c79ddc8, 0xd8f2d0f0, 0x800d0000, 0x0000c342, 0x0000c340, 0x6cf0ddc8)
    TEST_SB(0x9ff62c5a, 0xda5c9528, 0x800d0000, 0x0000d92c, 0x0000d92c, 0x9ff62c28)
    TEST_SB(0x8d23ef7b, 0xe20ee422, 0x800d0000, 0x00003f1e, 0x00003f1c, 0x8d22ef7b)
    TEST_SB(0x021a8000, 0xab922c0e, 0x800d0000, 0x0000669f, 0x0000669c, 0x0e1a8000)
    TEST_SB(0x2b323168, 0xb4810280, 0x800d0000, 0x000094b2, 0x000094b0, 0x2b803168)
    TEST_SB(0xfa0a8cc8, 0x1ab83286, 0x800d0000, 0x00009a0e, 0x00009a0c, 0xfa868cc8)
    TEST_SB(0xfba35550, 0x5f6cf2b0, 0x800d0000, 0x00008c40, 0x00008c40, 0xfba355b0)
    TEST_SB(0xccdc0930, 0x20dccff4, 0x800d0000, 0x0000aae8, 0x0000aae8, 0xccdc09f4)
    TEST_SB(0x50efe178, 0x00f8ce7a, 0x800d0000, 0x00001e5c, 0x00001e5c, 0x50efe17a)
    TEST_SB(0xc8946b68, 0x1e1fcf80, 0x800d0000, 0x00005cac, 0x00005cac, 0xc8946b80)
    TEST_SB(0x9e0efce6, 0x6b0ab578, 0x800d0000, 0x00005c18, 0x00005c18, 0x9e0efc78)
    TEST_SB(0x55b32c78, 0x43955964, 0x800d0000, 0x0000e5d2, 0x0000e5d0, 0x55642c78)
    TEST_SB(0xf2e02444, 0x385c0602, 0x800d0000, 0x0000a2e6, 0x0000a2e4, 0xf2022444)
    TEST_SB(0xa34cf9ae, 0xbefc9708, 0x800d0000, 0x00001476, 0x00001474, 0xa308f9ae)
    TEST_SB(0xdea4fad0, 0x7313e200, 0x800d0000, 0x00009b0c, 0x00009b0c, 0xdea4fa00)
    TEST_SB(0xbcdf3620, 0x9a6da064, 0x800d0000, 0x00008a00, 0x00008a00, 0xbcdf3664)
    TEST_SB(0xa3eda870, 0x80f6ff70, 0x800d0000, 0x00006410, 0x00006410, 0xa3eda870)
    TEST_SB(0x2779d654, 0xb41c7810, 0x800d0000, 0x0000ce98, 0x0000ce98, 0x2779d610)
    TEST_SB(0xde63ec11, 0xc22d8e54, 0x800d0000, 0x00004789, 0x00004788, 0xde635411)
    TEST_SB(0x98bfc55c, 0x12d8a1d8, 0x800d0000, 0x00005376, 0x00005374, 0x98d8c55c)
    TEST_SB(0x95b2b736, 0x30a7f300, 0x800d0000, 0x00001e7c, 0x00001e7c, 0x95b2b700)
    TEST_SB(0x408e7440, 0xa0b53160, 0x800d0000, 0x00003a87, 0x00003a84, 0x608e7440)
    TEST_SB(0x2d9b8c36, 0x077d6f24, 0x800d0000, 0x0000fccc, 0x0000fccc, 0x2d9b8c24)
    TEST_SB(0xc31bc4fa, 0x80264e9e, 0x800d0000, 0x0000e9cf, 0x0000e9cc, 0x9e1bc4fa)
    TEST_SB(0x0ae2b41c, 0xf3940600, 0x800d0000, 0x0000b6be, 0x0000b6bc, 0x0a00b41c)
    TEST_SB(0xd672125e, 0xf54f6e10, 0x800d0000, 0x000033e6, 0x000033e4, 0xd610125e)
    TEST_SB(0x16df9976, 0xb0be4800, 0x800d0000, 0x0000fc06, 0x0000fc04, 0x16009976)
    TEST_SB(0x9d3601ce, 0x79645dd6, 0x800d0000, 0x0000b998, 0x0000b998, 0x9d3601d6)
    TEST_SB(0xf08581f4, 0x2de5ab28, 0x800d0000, 0x000015f4, 0x000015f4, 0xf0858128)
    TEST_SB(0x52c882b0, 0x0bbcd41c, 0x800d0000, 0x00007eae, 0x00007eac, 0x521c82b0)
    TEST_SB(0x18178fb0, 0xb008d7c8, 0x800d0000, 0x0000c514, 0x0000c514, 0x18178fc8)
    TEST_SB(0xc1958740, 0x44c60618, 0x800d0000, 0x0000ae68, 0x0000ae68, 0xc1958718)
    TEST_SB(0x9ca3e13c, 0x53ccf0e9, 0x800d0000, 0x0000e150, 0x0000e150, 0x9ca3e1e9)
    TEST_SB(0x3a0d9754, 0xe204a4bd, 0x800d0000, 0x00005e50, 0x00005e50, 0x3a0d97bd)
    TEST_SB(0xc17ba750, 0x9d1ba87b, 0x800d0000, 0x00005c87, 0x00005c84, 0x7b7ba750)
    TEST_SB(0x3df6d256, 0x5e9b6298, 0x800d0000, 0x00000001, 0x00000000, 0x3df69856)
    TEST_SB(0x5f50b378, 0xd1563c04, 0x800d0000, 0x00000002, 0x00000000, 0x5f04b378)
    TEST_SB(0x036bb8b0, 0x109356f8, 0x800d0000, 0x00000001, 0x00000000, 0x036bf8b0)
    TEST_SB(0x8d1210b8, 0xbd9940a5, 0x800d0000, 0x00000000, 0x00000000, 0x8d1210a5)
    TEST_SB(0xae1f4651, 0xd53dd416, 0x800d0000, 0x00000001, 0x00000000, 0xae1f1651)
    TEST_SB(0x76f9942c, 0x5eb1d1e8, 0x800d0000, 0x00000002, 0x00000000, 0x76e8942c)
    TEST_SB(0xfb192df2, 0x4cdbd878, 0x800d0000, 0x00000000, 0x00000000, 0xfb192d78)
    TEST_SB(0x7854532e, 0x895bbb88, 0x800d0000, 0x00000002, 0x00000000, 0x7888532e)
    TEST_SB(0xe918ba4c, 0xd1c99748, 0x800d0000, 0x00000002, 0x00000000, 0xe948ba4c)
    TEST_SB(0x9cdfb200, 0x85af1f1e, 0x800d0000, 0x00000001, 0x00000000, 0x9cdf1e00)
    TEST_SB(0x9a163388, 0x7ba8c8a0, 0x800d0000, 0x00000003, 0x00000000, 0xa0163388)
    TEST_SB(0x0676c233, 0x9dafdbd4, 0x800d0000, 0x00000003, 0x00000000, 0xd476c233)
    TEST_SB(0xd52c0b08, 0x48d72a28, 0x800d0000, 0x00000000, 0x00000000, 0xd52c0b28)
    TEST_SB(0xc47f87c8, 0xb57cc36c, 0x800d0000, 0x00000000, 0x00000000, 0xc47f876c)
    TEST_SB(0x4416dbe6, 0xea6170e8, 0x800d0000, 0x00000000, 0x00000000, 0x4416dbe8)
    TEST_SB(0xa6a82196, 0x3fe8f8a2, 0x800d0000, 0x00000000, 0x00000000, 0xa6a821a2)
    TEST_SB(0x0971f49e, 0xcaedfd56, 0x800d0000, 0x00000002, 0x00000000, 0x0956f49e)
    TEST_SB(0x06ebfb12, 0xee54a808, 0x800d0000, 0x00000001, 0x00000000, 0x06eb0812)
    TEST_SB(0xcc67595e, 0xc3746cb0, 0x800d0000, 0x00000000, 0x00000000, 0xcc6759b0)
    TEST_SB(0x3b4e02ac, 0x94862c00, 0x800d0000, 0x00000002, 0x00000000, 0x3b0002ac)
    TEST_SB(0xe21e9e40, 0x03ad75f4, 0x800d0000, 0x00000000, 0x00000000, 0xe21e9ef4)
    TEST_SB(0x2a4f1a28, 0x1a251802, 0x800d0000, 0x00000000, 0x00000000, 0x2a4f1a02)
    TEST_SB(0x2de3b624, 0x394a6480, 0x800d0000, 0x00000002, 0x00000000, 0x2d80b624)
    TEST_SB(0x163a9c0e, 0x98295f3e, 0x800d0000, 0x00000000, 0x00000000, 0x163a9c3e)
    TEST_SB(0x4e95b5e6, 0xab39a0f1, 0x800d0000, 0x00000003, 0x00000000, 0xf195b5e6)
    TEST_SB(0x72a013f3, 0x920b6b7c, 0x800d0000, 0x00000003, 0x00000000, 0x7ca013f3)
    TEST_SB(0x5ff78063, 0xb3be48f8, 0x800d0000, 0x00000003, 0x00000000, 0xf8f78063)
    TEST_SB(0x857c8744, 0xbd046514, 0x800d0000, 0x00000000, 0x00000000, 0x857c8714)
    TEST_SB(0x387fdade, 0x542f67c0, 0x800d0000, 0x00000001, 0x00000000, 0x387fc0de)
    TEST_SB(0xf96b1db0, 0xc78fac20, 0x800d0000, 0x00000001, 0x00000000, 0xf96b20b0)
    TEST_SB(0xda28716c, 0x6e6d40e0, 0x800d0000, 0x00000000, 0x00000000, 0xda2871e0)
    TEST_SB(0x00000000, 0x00000000, 0x800d0000, 0x00000000, 0x00000000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop     
###score ++ 
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n65_sb_test)
